webpackJsonp([3],{

/***/ 222:
/***/ (function(module, exports, __webpack_require__) {

var disposed = false
function injectStyle (ssrContext) {
  if (disposed) return
  __webpack_require__(242)
}
var normalizeComponent = __webpack_require__(20)
/* script */
var __vue_script__ = __webpack_require__(244)
/* template */
var __vue_template__ = __webpack_require__(245)
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-5b8c1046"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  __vue_script__,
  __vue_template__,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)
Component.options.__file = "resources\\assets\\js\\components\\admin\\sys_setting\\admins.vue"

/* hot reload */
if (false) {(function () {
  var hotAPI = require("vue-loader/node_modules/vue-hot-reload-api")
  hotAPI.install(require("vue"), false)
  if (!hotAPI.compatible) return
  module.hot.accept()
  if (!module.hot.data) {
    hotAPI.createRecord("data-v-5b8c1046", Component.options)
  } else {
    hotAPI.reload("data-v-5b8c1046", Component.options)
  }
  module.hot.dispose(function (data) {
    disposed = true
  })
})()}

module.exports = Component.exports


/***/ }),

/***/ 242:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(243);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(19)("4c373b22", content, false, {});
// Hot Module Replacement
if(false) {
 // When the styles change, update the <style> tags
 if(!content.locals) {
   module.hot.accept("!!../../../../../../node_modules/_css-loader@0.28.11@css-loader/index.js!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-5b8c1046\",\"scoped\":true,\"hasInlineConfig\":true}!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/selector.js?type=styles&index=0!./admins.vue", function() {
     var newContent = require("!!../../../../../../node_modules/_css-loader@0.28.11@css-loader/index.js!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-5b8c1046\",\"scoped\":true,\"hasInlineConfig\":true}!../../../../../../node_modules/_vue-loader@13.7.1@vue-loader/lib/selector.js?type=styles&index=0!./admins.vue");
     if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
     update(newContent);
   });
 }
 // When the module is disposed, remove the <style> tags
 module.hot.dispose(function() { update(); });
}

/***/ }),

/***/ 243:
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(14)(false);
// imports


// module
exports.push([module.i, "\n.el-form-item[data-v-5b8c1046] {\n    margin-top: 30px;\n}\n", ""]);

// exports


/***/ }),

/***/ 244:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

/* harmony default export */ __webpack_exports__["default"] = ({
    data: function data() {
        var _this = this;

        //自定义验证规则
        var passwordSame = function passwordSame(rule, value, callback) {
            if (value !== _this.ruleForm.password) {
                callback(new Error('两次密码输入不一致'));
            }
            callback();
        };
        return {
            hint: {
                'title': '操作提示',
                'content': '后台管理员列表，超级管理员不在此列表内！'
            },
            now_address: {
                address: '管理员',
                doing: '编辑'
            },
            num: null,
            tableData: [],
            loading: true,
            list_show: '',
            add_show: '',
            ruleForm: this.start_data(),
            roles: [], //所有角色
            admin_id: null, //管理员id
            rules: {
                name: [{ required: true, message: '请输入管理员名称', trigger: 'blur' }, { min: 5, max: 20, message: '长度在 5 到 20 个字符', trigger: 'blur' }],
                role: [{ required: true, message: '请选择管理员角色', trigger: 'change' }],
                password: [{ required: true, message: '请输入管理员登录密码', trigger: 'blur' }, { min: 5, max: 20, message: '长度在 5 到 20 个字符', trigger: 'blur' }],
                re_password: [{ required: true, message: '请输入确认密码', trigger: 'blur' }, { validator: passwordSame, trigger: 'blur' }]
            }
        };
    },
    created: function created() {
        this.get_admins(); //获取管理员列表
        this.go_back(); //列表显示页
    },

    methods: {
        get_admins: function get_admins() {
            var _this2 = this;

            //获取管理员列表
            axios.post(this.adminApi('admins-list')).then(function (res) {
                _this2.loading = false;
                if (res.data.code === 0) {
                    _this2.tableData = res.data.info;
                    _this2.num = _this2.tableData.length;
                } else {
                    _this2.$message.error(res.data.msg);
                }
            }).catch(function (err) {
                _this2.$message.error('请稍后重试');
            });
        },
        add_page: function add_page() {
            //进入添加界面
            this.ruleForm = this.start_data();
            this.list_show = false;
            this.add_show = true;
            this.get_roles();
        },
        go_back: function go_back() {
            //列表界面
            this.list_show = true;
            this.add_show = false;
        },
        submitForm: function submitForm(formName) {
            var _this3 = this;

            this.$refs[formName].validate(function (valid) {
                if (valid) {
                    _this3.save_admin();
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
        start_data: function start_data() {
            //清除添加或保存数据
            return {
                name: '',
                role: '',
                password: '',
                re_password: ''
            };
        },
        save_admin: function save_admin() {
            var _this4 = this;

            //保存管理员
            axios.post(this.adminApi('admins-save'), {
                id: this.admin_id,
                name: this.ruleForm.name,
                role: this.ruleForm.role,
                password: this.ruleForm.password
            }).then(function (res) {
                if (res.data.code === 0) {
                    _this4.$message.success(res.data.msg);
                    _this4.get_admins();
                    _this4.go_back();
                } else {
                    _this4.$message.error(res.data.msg);
                }
            }).catch(function (err) {
                _this4.$message.error('请稍后重试');
            });
        },
        edit_admins: function edit_admins(id) {
            var _this5 = this;

            //编辑管理员
            this.add_page();
            axios.post(this.adminApi("admins-edit"), {
                id: id
            }).then(function (res) {
                if (res.data.code === 0) {
                    _this5.admin_id = res.data.info.id;
                    _this5.ruleForm.name = res.data.info.name;
                    _this5.ruleForm.role = res.data.info.role_id;
                } else {
                    _this5.$message.error(res.data.msg);
                }
            }).catch(function (err) {
                _this5.$message.error('请重新刷新！');
            });
        },
        get_roles: function get_roles() {
            var _this6 = this;

            //获取角色列表
            axios.post(this.adminApi('roles-list')).then(function (res) {
                if (res.data.code === 0) {
                    _this6.roles = res.data.info;
                } else {
                    _this6.$message.error(res.data.msg);
                }
            }).catch(function (err) {
                _this6.$message('请重新刷新');
            });
        },
        del_admins: function del_admins(id) {
            var _this7 = this;

            this.$confirm('此操作将永久删除, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(function () {
                //确定执行下面
                axios.post(_this7.adminApi("admins-del"), {
                    id: id
                }).then(function (res) {
                    if (res.data.code === 0) {
                        _this7.$message.success(res.data.msg);
                        _this7.get_admins();
                    } else {
                        _this7.$message.error(res.data.msg);
                    }
                }).catch(function (err) {
                    _this7.$message.error('请重新刷新');
                });
            });
        }
    }
});

/***/ }),

/***/ 245:
/***/ (function(module, exports, __webpack_require__) {

var render = function() {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c("div", [
    _c(
      "div",
      {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.list_show,
            expression: "list_show"
          }
        ],
        staticClass: "m-box"
      },
      [
        _c("hint", {
          attrs: { title: _vm.hint.title, content: _vm.hint.content }
        }),
        _vm._v(" "),
        _c(
          "h2",
          [
            _vm._v(
              "管理员列表（共有" + _vm._s(_vm.num) + "条记录）\n            "
            ),
            _c(
              "el-button",
              {
                attrs: { type: "primary", plain: "", size: "small" },
                on: { click: _vm.add_page }
              },
              [_vm._v("添 加")]
            )
          ],
          1
        ),
        _vm._v(" "),
        _c(
          "el-table",
          {
            directives: [
              {
                name: "loading",
                rawName: "v-loading",
                value: _vm.loading,
                expression: "loading"
              }
            ],
            staticStyle: { width: "100%" },
            attrs: { data: _vm.tableData, border: "" }
          },
          [
            _c("el-table-column", { attrs: { prop: "id", label: "ID" } }),
            _vm._v(" "),
            _c("el-table-column", {
              attrs: { prop: "name", label: "管理员名称" }
            }),
            _vm._v(" "),
            _c("el-table-column", {
              attrs: { prop: "roleName", label: "管理员角色" }
            }),
            _vm._v(" "),
            _c("el-table-column", {
              attrs: { fixed: "right", label: "操作" },
              scopedSlots: _vm._u([
                {
                  key: "default",
                  fn: function(scope) {
                    return [
                      _c(
                        "el-button",
                        {
                          attrs: { type: "primary", size: "small" },
                          on: {
                            click: function($event) {
                              _vm.edit_admins(scope.row.id)
                            }
                          }
                        },
                        [_vm._v("编辑")]
                      ),
                      _vm._v(" "),
                      _c(
                        "el-button",
                        {
                          attrs: { type: "danger", size: "small" },
                          on: {
                            click: function($event) {
                              _vm.del_admins(scope.row.id)
                            }
                          }
                        },
                        [_vm._v("删除")]
                      )
                    ]
                  }
                }
              ])
            })
          ],
          1
        )
      ],
      1
    ),
    _vm._v(" "),
    _c(
      "div",
      {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.add_show,
            expression: "add_show"
          }
        ],
        staticClass: "m-box"
      },
      [
        _c("now-position", {
          attrs: {
            address: _vm.now_address.address,
            doing: _vm.now_address.doing
          },
          on: { "go-back": _vm.go_back }
        }),
        _vm._v(" "),
        _c(
          "el-form",
          {
            ref: "ruleForm",
            staticClass: "demo-ruleForm",
            attrs: {
              model: _vm.ruleForm,
              rules: _vm.rules,
              "label-width": "300px"
            }
          },
          [
            _c(
              "el-form-item",
              { attrs: { label: "管理员名称", prop: "name" } },
              [
                _c("el-input", {
                  model: {
                    value: _vm.ruleForm.name,
                    callback: function($$v) {
                      _vm.$set(_vm.ruleForm, "name", $$v)
                    },
                    expression: "ruleForm.name"
                  }
                }),
                _vm._v(" "),
                _c("em", { staticClass: "c-danger" }, [
                  _vm._v("只能为纯字母组成")
                ])
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "el-form-item",
              { attrs: { label: "管理员角色", prop: "role" } },
              [
                _c(
                  "el-select",
                  {
                    attrs: { placeholder: "请选择管理员角色" },
                    model: {
                      value: _vm.ruleForm.role,
                      callback: function($$v) {
                        _vm.$set(_vm.ruleForm, "role", $$v)
                      },
                      expression: "ruleForm.role"
                    }
                  },
                  _vm._l(_vm.roles, function(item) {
                    return _c("el-option", {
                      key: item.id,
                      attrs: { label: item.name, value: item.id }
                    })
                  })
                )
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "el-form-item",
              { attrs: { label: "管理员密码", prop: "password" } },
              [
                _c("el-input", {
                  attrs: { type: "password" },
                  model: {
                    value: _vm.ruleForm.password,
                    callback: function($$v) {
                      _vm.$set(_vm.ruleForm, "password", $$v)
                    },
                    expression: "ruleForm.password"
                  }
                }),
                _vm._v(" "),
                _c("em", { staticClass: "c-danger" }, [
                  _vm._v("必须由字母、数字、特殊符号组成")
                ])
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "el-form-item",
              { attrs: { label: "确认密码", prop: "re_password" } },
              [
                _c("el-input", {
                  attrs: { type: "password" },
                  model: {
                    value: _vm.ruleForm.re_password,
                    callback: function($$v) {
                      _vm.$set(_vm.ruleForm, "re_password", $$v)
                    },
                    expression: "ruleForm.re_password"
                  }
                })
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "el-form-item",
              [
                _c(
                  "el-button",
                  {
                    attrs: { type: "primary" },
                    on: {
                      click: function($event) {
                        _vm.submitForm("ruleForm")
                      }
                    }
                  },
                  [_vm._v("确认保存")]
                )
              ],
              1
            )
          ],
          1
        )
      ],
      1
    )
  ])
}
var staticRenderFns = []
render._withStripped = true
module.exports = { render: render, staticRenderFns: staticRenderFns }
if (false) {
  module.hot.accept()
  if (module.hot.data) {
    require("vue-loader/node_modules/vue-hot-reload-api")      .rerender("data-v-5b8c1046", module.exports)
  }
}

/***/ })

});